package com.zhw.service.impl;


import com.zhw.mapper.LinkManMapper;
import com.zhw.pojo.entry.CustomerLinkMan;
import com.zhw.pojo.vo.LinkManVO;
import com.zhw.service.LinkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Service
public class LinkServiceImpl implements LinkService {
    @Autowired
    LinkManMapper linkManMapper;

    @Override
    public List<LinkManVO> getLinkMan(CustomerLinkMan customerLinkMan) {
        return linkManMapper.getLinkMan(customerLinkMan);
    }


    @Override
    public CustomerLinkMan getLinkManByID(Integer id) {
        return linkManMapper.getLinkManByID(id);
    }


    @Override
    public void save(CustomerLinkMan customerLinkMan) {
        customerLinkMan.setIsValid(1);
        customerLinkMan.setCeateDate(LocalDateTime.now());
        customerLinkMan.setUpdateDate(LocalDateTime.now());
        linkManMapper.save(customerLinkMan);

    }


    @Override
    public void update(CustomerLinkMan customerLinkMan) {
        customerLinkMan.setUpdateDate(LocalDateTime.now());
        linkManMapper.update(customerLinkMan);
    }


    @Override
    public void deleteById(Integer id) {
        linkManMapper.deleteByID(id);
    }
}
